/*
 * Copyright (C), 2002-2017, 南京苏宁软件技术有限公司
 * FileName: ExchangeConstants.java
 * Author:   10070706
 * Date:     2017年5月3日 上午11:51:35
 * Description: //模块目的、功能描述      
 * History: //修改记录
 * <author>      <time>      <version>    <desc>
 * 修改人姓名             修改时间            版本号                  描述
 */
package com.suning.sawp.constants;

import org.apache.commons.lang3.StringUtils;

/**
 * 〈以旧换新常量〉<br>
 *
 * @author 10070706
 */
public class ExchangeConstants {

    private ExchangeConstants() {
        // empty method
    }

    /**
     * 客户端分页默认页大小
     */
    public static final int PAGE_SIZE = 10;

    /**
     * list联立的分隔符
     */
    public static final String SPLIT_LIST = ",";

    /**
     * 调用售后拉取订单成功
     */
    public static final String ASOM_ERR_CODR_OF_SUCCESS = "1";

    /**
     * 发券接口-查询
     */
    public static final String OP_TYPE_QUERY = "1";

    /**
     * 发券接口-发放
     */
    public static final String OP_TYPE_SEND = "2";

    /**
     * 发券接口-caller参数
     */
    public static final String CALLER = "2";

    /**
     * 发券接口-终端编码参数
     */
    public static final String TERMINAL = "32";

    /**
     * 发券接口-奖励触发事件编号
     */
    public static final String BONUS_TRIGER_ID = "69";

    /**
     * 发券接口-返回失败
     */
    public static final String SEND_COUPON_RESULT_FALE = "0";

    /**
     * 发券接口- 券 单张
     */
    public static final String COUPON_NUM_ONE = "1";

    /**
     * 发券接口- 券 多张
     */
    public static final String COUPON_NUM_MORE = "2";

    /**
     * 发券接口-返回成功
     */
    public static final String SEND_COUPON_RESULT_SUCCESS = "1";

    public static enum OrderStatus {
        INIT("1", "订单受理中"), USER_HAS_DELIVER_GOODS("20", "用户已发货"), HANDLING("2", "处理中"), SERVICE_FINISH("3",
                "服务完成"), CANCEL("4", "订单已取消"), CANCELING("40", "取消中"), REFUNDING("5", "退货中"), REFUND_FINISH("6",
                        "退货完成"), PAY_FINISH("7", "支付完成"), PAYING("70", "支付中"), PAY_FAILED("8", "支付失败");
        private String status;
        private String msg;

        public String getStatus() {
            return status;
        }

        public String getMsg() {
            return msg;
        }

        OrderStatus(String status, String msg) {
            this.status = status;
            this.msg = msg;
        }

        public static String getMsg(String status) {
            for (OrderStatus per : OrderStatus.values()) {
                if (StringUtils.equals(status, per.getStatus())) {
                    return per.getMsg();
                }
            }
            return StringUtils.EMPTY;
        }
    }

    /**
     * 查询商品详情返回查询不到
     */
    public static final String TOTAL_COUNT_ZERO = "0";

    public enum TerminalName {
        WEB("31", "网站"), APP("32", "移动终端"), YUN_XIN("33", "云信终端"), PHONE("34", "电话销售"), TV("35", "电视终端"), WAP("36",
                "WAP"), STORE("37", "门店"), MARKET("38",
                        "超市"), PPTV("39", "PPTV"), PLAZA("40", "商业广场"), WEI_STORE("41", "微店"), END("", "");

        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        TerminalName(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public static String getName(String code) {
            for (TerminalName terminalName : TerminalName.values()) {
                if (StringUtils.equals(code, terminalName.getCode())) {
                    return terminalName.getName();
                }
            }
            return StringUtils.EMPTY;
        }
    }

    public enum CouponType {
        TYPE_1001("10001", "云券"), TYPE_1002("10002", "限品类云券"), TYPE_1003("10003", "店铺云券"), TYPE_1004("10004",
                "易券"), TYPE_1005("10005", "限品类易券"), TYPE_1006("10006", "店铺易券"), TYPE_1007("10007",
                        "易付宝通用券"), TYPE_1008("10008", "易付宝专用券"), TYPE_1009("10009", "无敌券"), TYPE_1010("10010",
                                "免运费券"), TYPE_1011("10011", "店铺免运费券"), TYPE_1012("10012",
                                        "SIM卡券"), TYPE_1013("10013", "自营无敌券"), TYPE_1014("10014", "大聚惠理财券"),

        END("", "");
        private String code;

        private String name;

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }

        CouponType(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public static String getName(String code) {
            for (CouponType couponType : CouponType.values()) {
                if (StringUtils.equals(code, couponType.getCode())) {
                    return couponType.getName();
                }
            }
            return StringUtils.EMPTY;
        }
    }

    public static final String PART_SCOPE_QUANTITY_LIMIT_NUMBER = "2000";

    /**
     * 活动规则，订单状态配置
     */
    public static final int RULE_ORDER_STATUS = 1;

    /**
     * 活动规则，品类配置
     */
    public static final int RULE_CATE = 2;

    /**
     * 12位城市
     */
    public static final int COUPON_CENTER_CITY_LEN = 12;

    /**
     * 渠道编号
     */
    public static final String CHANNEL_ID = "10";
}
